var MongoClient = require('mongodb').MongoClient;
class MongodbConnect{
	constructor(url){
		this.url=url
        this.db;
    }
    open(database){
		return new Promise((resolve, reject) => {
            MongoClient.connect(this.url, (err, db)=>{
                if (err)  reject(err);
                this.db=db;
                var dbo = db.db(database);
                resolve(dbo)
            });

		})
    }
	close(){
		this.db.close();
	}

	setCrmUser(){
		
	}
}

module.exports = MongodbConnect;